package com.example.webdemo.model;

import com.fasterxml.jackson.annotation.JsonFormat;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.List;

/**
 * @description:  保存文章详情
 * @author zp
 * @date: 2023/8/18 19:42
 */
public class ArticleInfo {
    private Integer id;

    private Integer userId;
    @NotBlank(message = "文章描述不能为空")
    @Min(value = 5, message = "文章描述字数必须大于等于18")
    @Max(value = 50, message = "文章描述必字数须小于等于18")
    private String articleDesc;
    @NotBlank(message = "文章标题不能为空")
    @Min(value = 5, message = "文章标题字数必须大于等于18")
    @Max(value = 20, message = "文章标题字数必须小于等于18")
    private String title;

    private String author;
    @NotBlank(message = "文章封面图片链接不能为空")
    private String thumb;

    private String tags;
    @NotBlank(message = "文章标签不能为空")
    private List<Tag> tagNames; // tag的信息

    private Integer articleStatus;
    @NotBlank(message = "文章状态不能为空")
    private Integer articleType;

    private Integer likeNum; // 点赞数量

    private Integer collectNum; // 收藏

    private Integer commentNum;// 评论

    private Integer shareNum;// 收藏
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date releaseData;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    @NotBlank(message = "文章内容不能为空")
    @Max(value = 10000, message = "文章标题字数必须小于等于10000")
    private String context;

    public List<Tag> getTagNames() {
        return tagNames;
    }

    public void setTagNames(List<Tag> tagNames) {
        this.tagNames = tagNames;
    }

    public String getArticleDesc() {
        return articleDesc;
    }

    public void setArticleDesc(String articleDesc) {
        this.articleDesc = articleDesc;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author == null ? null : author.trim();
    }

    public String getThumb() {
        return thumb;
    }

    public void setThumb(String thumb) {
        this.thumb = thumb == null ? null : thumb.trim();
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags == null ? null : tags.trim();
    }

    public Integer getArticleStatus() {
        return articleStatus;
    }

    public void setArticleStatus(Integer articleStatus) {
        this.articleStatus = articleStatus;
    }

    public Integer getArticleType() {
        return articleType;
    }

    public void setArticleType(Integer articleType) {
        this.articleType = articleType;
    }

    public Integer getLikeNum() {
        return likeNum;
    }

    public void setLikeNum(Integer likeNum) {
        this.likeNum = likeNum;
    }

    public Integer getCollectNum() {
        return collectNum;
    }

    public void setCollectNum(Integer collectNum) {
        this.collectNum = collectNum;
    }

    public Integer getCommentNum() {
        return commentNum;
    }

    public void setCommentNum(Integer commentNum) {
        this.commentNum = commentNum;
    }

    public Integer getShareNum() {
        return shareNum;
    }

    public void setShareNum(Integer shareNum) {
        this.shareNum = shareNum;
    }

    public Date getReleaseData() {
        return releaseData;
    }

    public void setReleaseData(Date releaseData) {
        this.releaseData = releaseData;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context == null ? null : context.trim();
    }

    @Override
    public String toString() {
        return "ArticleInfo{" +
                "id=" + id +
                ", userId=" + userId +
                ", articleDesc='" + articleDesc + '\'' +
                ", title='" + title + '\'' +
                ", author='" + author + '\'' +
                ", thumb='" + thumb + '\'' +
                ", tags='" + tags + '\'' +
                ", tagNames=" + tagNames +
                ", articleStatus=" + articleStatus +
                ", articleType=" + articleType +
                ", likeNum=" + likeNum +
                ", collectNum=" + collectNum +
                ", commentNum=" + commentNum +
                ", shareNum=" + shareNum +
                ", releaseData=" + releaseData +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", context='" + context + '\'' +
                '}';
    }
}